package com.learn.singleton;

/**
 * <p>项目名称: design-pattern </p>
 *
 * <p>文件名称: EnumSingleton </p>
 *
 * Enum based singleton implementation. Effective Java 2nd Edition (Joshua Bloch) p. 18
 *
 * This implementation is thread safe, however adding any other method and its thread safety
 * is developers responsibility.
 */
public enum  EnumSingleton {

    INSTANCE;

    @Override
    public String toString() {
        return getDeclaringClass().getCanonicalName() + "@" + hashCode();
    }
}
